package cn.codenest.rabbitmqsteamtest.util.impl;

import cn.codenest.rabbitmqsteamtest.config.OutputMessageBinding;
import cn.codenest.rabbitmqsteamtest.util.RbmqService;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author ：Hyman
 * @date ：Created in 2021/7/6 20:31
 * @description：
 * @modified By：
 * @version: $
 */
@Service
@EnableBinding({OutputMessageBinding.class})
public class RbmqServiceImpl implements RbmqService {

    @Resource
    private OutputMessageBinding outputMessageBinding;

    @Override
    public void sendMsg(String msg) {
        outputMessageBinding.output().send(MessageBuilder.withPayload(msg).build());
    }
}
